from flask import Flask
from config import Config
from flask_cors import CORS

def create_app(config_class = Config):
    # 加载配置
    app=Flask(__name__)
    app.config.from_object(config_class)

    # 跨域
    CORS(app)

    # 注册蓝图 blueprint
    from app.api import bp as api_bp
    app.register_blueprint(api_bp, url_prefix = "/api")

    return app